package cn.tnar.controller;

import cn.tnar.wx.components.WxMenuComponent;
import cn.tnar.wx.dto.SubButtonInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: 陈亮
 * @Date: 2018/10/14 11:53
 */
@Api(tags = "微信-菜单相关")
@RestController
public class WxMenuController {

    @Autowired
    private WxMenuComponent wxMenuComponent;

    @ApiOperation(value = "查询菜单")
    @GetMapping(value = "menuget")
    public Object menuGet() {
        return wxMenuComponent.menuGet();
    }

    @ApiOperation(value = "创建菜单")
    @PostMapping(value = "menucreate")
    public Object menuCreate(@RequestHeader("Token") String token, @RequestBody SubButtonInfo[] button) {
        return wxMenuComponent.menuCreate(button);
    }

    @ApiOperation(value = "删除菜单")
    @DeleteMapping(value = "menudelete")
    public Object menuDelete(@RequestHeader("Token") String token) {
        return wxMenuComponent.menuDelete();
    }

}
